package 集合框架.Set.课后作业.M2;

import java.util.Iterator;
import java.util.LinkedList;

/**
 * 第2题:已知数组存放一批QQ号码，QQ号码最长为11位，
 * 最短为5位String[] strs = {"12345","67891",
 * "12347809933","98765432102","67891","12347809933"}。
 * 将该数组里面的所有qq号都存放在LinkedList中，将list中重复元素删除，
 * 将list中所有元素分别用迭代器和增强for循环打印出来。
 */
public class Test {
    public static void main(String[] args) {
        String[] str = {"12345","67891","12347809933","98765432102","67891","12347809933"};
        LinkedList<String> strList = new LinkedList<>();
        for (int i = 0; i < str.length; i++) {

            strList.add(str[i]);
        }

        for (String s : strList) {
            System.out.println(s);
        }
        System.out.println("-------------------------------");
        strList.remove(1);
        strList.remove(2);


        Iterator<String> strIter  = strList.iterator();
        while (strIter.hasNext()){
            System.out.println(strIter.next());
        }
    }
    }

